{include file="public/header"/}
<div class="layui-payment-wxcode layui-padding-4">
    <div class="code-infor space-between">
        <div class="code-infor-content">
            <div class="justify-content-center">
                <img src="/static/images/order/wx-pay.png">
                <p class="margin-left-10">请使用微信扫一扫 <br> 扫二维码支付</p>
            </div>
            <div class="code-box" style="background-image: url(/static/images/order/wxpay-code.png);">
                <div id="wxpay-qrcode">
                    <img src="{$info.qrcode_url}">
                </div>
            </div>
            <p class="tips"><span class="layui-font-success font-weight-bold number">5</span> 分钟后二维码失效，请尽快支付</p>
        </div>
        <img src="/static/images/order/phone.png" class="phone-img">
    </div>
    <div class="layui-font-success switch-button">[ 更换支付方式 ]</div>
</div>
<script type="text/javascript">
     layui.use(['form','layer'], function(){
        var layer = layui.layer, form = layui.form, $ = layui.$;
        
        // 检查订单是否支付
        function checkOrderPay(order_id) {
            setInterval(function () {
                $.ajax({
                    url:'/order/check_order_pay',
                    type:'post',
                    data:{"order_id":order_id},
                    dataType:"JSON",
                    success:function(res){
                        if(res.code == 0){ // 支付成功
                            layer.msg(res.msg,{icon: 1,time:1500},function(){
                                layer.closeAll();
                                location.href = '/user/order';
                            })
                        }
                    }
                });
            }, 5000);
        }
    })
</script>